package com.bokee.archerwq.lab.pattern.state;

import junit.framework.TestCase;

import org.junit.Assert;

/**
 * test the state machine
 * 
 * @author Will 2010-4-6
 */
public class ContextTest extends TestCase {

	public void testStateMachine() {
		Context cxt = new Context();
		Assert.assertEquals(Context.state1, cxt.getState());
		cxt.event1();
		Assert.assertEquals(Context.state2, cxt.getState());
		cxt.event1();
		Assert.assertEquals(Context.state2, cxt.getState());
		cxt.event2();
		Assert.assertEquals(Context.state1, cxt.getState());
		cxt.event2();
		Assert.assertEquals(Context.state1, cxt.getState());
	}

}
